<template>
    <view class="popup" @click.self="close">
        <view class="popup-con">
			<view class="popup-con-title">
				<text class="left">Type</text>
				<image src="@/static/common/close.png" @click.stop="close"></image>
			</view>
			
			<view class="popup-con-box">
				<view
					v-for="item in filterData"
					:key="item.value"
					:class="{'current':item.value == isActive}"
					@click="selectItem(item)"
				>{{item.label}}</view>
			</view>
        </view>
    </view>
</template>
<script>
export default{
	props:{
		filterData:{
			type:Array,
			default:()=>[]
		}
	},
	data() {
		return {
			isActive:""
		}
	},
    methods:{
        selectItem(item){
			const propData = {
				value:this.isActive == item.value ? 0 : item.value
			}
			this.isActive = this.isActive == item.value ? "" :item.value;
			this.$emit("done",propData)
            this.close()
        },
		close(){
			this.$emit("close")
		}
    }
}
</script>

<style  scoped lang="scss">
	.popup{
		z-index: 999;
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		display: flex;
		align-items: flex-end;
		justify-content: center;
		background: rgba(20,20,22,0.3);
		&-con{
			width: 100%;
			border-radius: 20rpx 20rpx 0 0;
			background-color: #fff;
			box-shadow: 0px 4px 40px 0px rgba(0,0,0,0.25);
			display: flex;
			flex-direction: column;
			justify-content: flex-start;
			align-items: center;
			min-height: 600rpx;
			&-title{
				width: 100%;
				display: flex;
				justify-content:space-between;
				align-items: center;
				font-size: 24rpx;
				color: #1D1E25;
				line-height: 36rpx;
				padding: 20rpx 36rpx;
				border-bottom: 1px solid #E6E9ED;
				.left{
					flex: 1;
					text-align: center;
					font-size: 32rpx;
					font-weight: 500;
					line-height: 48rpx;
					justify-self: center;
				}
				image{
					width: 48rpx;
					height: 48rpx;
				}
			}
			&-box{
				width: 100%;
				padding: 32rpx 28rpx;
				display: flex;
				// justify-content: space-between;
				flex-wrap: wrap;
				view{
					width: 32%;
					padding: 24rpx 0;
					margin-top: 32rpx;
					margin-right: 2%;
					text-align: center;
					background: #F0F0F0;
					border-radius: 8rpx;
					font-weight: 600;
					font-size: 24rpx;
					color: #333333;
					line-height: 28rpx;
					&:nth-child(-n+3){
						margin-top: 0;
					}
					&:nth-child(3n){
						margin-right: 0;
					}
				}
				.current{
					background: rgba(26, 123, 153, 0.2);
					color: #1A7B99;
				}
			}
		}
	}
</style>
